<%
# Copyright (C) 2016 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%
  module_item_conditional_next ||= nil
  module_item ||= module_item_conditional_next
  item_data ||= { published_status: 'unpublished' }
  completion_criteria ||= nil
  editable ||= false
  criterion = completion_criteria && completion_criteria.find{|c| c[:id] == module_item.id}
%>

<li
  id="context_module_item_<%= module_item ? module_item.id : 'blank' %>"
  class="context_module_item context_module_item_conditional_info indent_<%= module_item.try_rescue(:indent) || '0' %>"
>
  <div class="ig-row">
<%
  if item_data[:mastery_paths][:locked]
%>
    <span class="type_icon" title="{{#t}}Locked Content{{/t}}">
      <span class="ig-type-icon">
        <i class="icon-lock" aria-label="{{#t}}Item type: Locked{{/t}}"></i>
      </span>
    </span>
    <div class="ig-info">
      <div class="module-item-title">
        <span class="item_name" id="module-item-locked-<%= module_item.id %>">
          <em class="ig-title">
            <%= t('Locked until "%{item_name}" is graded', {item_name: module_item.content.title}) %>
          </em>
        </span>
      </div>
    </div>
<%
  else
%>
    <span class="type_icon" title="{{#t}}Content Choice{{/t}}">
      <span class="ig-type-icon">
        <i class="icon-unlock" aria-label="{{#t}}Item type: Choice{{/t}}"></i>
      </span>
    </span>
    <div class="ig-info">
      <div class="module-item-title">
        <span class="item_name">
          <a href="<%= item_data[:choose_url] %>" title="{{#t}}Choose Assignment Group{{/t}}" class="ig-title">
            {{#t}}Choose Assignment Group{{/t}}
          </a>
        </span>
        <span class='conditional_options_count'>
          <%= t({ one: '1 Option', other: '%{count} Options' }, { count: item_data[:mastery_paths][:assignment_sets].count }) %>
        </span>
      </div>
    </div>
<%
  end
%>
  </div>
</li>
